<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>string</title>
</head>
<body>
    <script>
        //引号的用法
        let str = 'hello';
        let str1 = 'wolrd';
        let str2 = 'let go';
        let str3 = "i said 'this is my dog'";
         let str4 = "i said\ 'this is my cat\'";
         let str5 = 'hello javascript';
         var len = str5.length;
         console.log('字符串长度'+len);
         //获得java出现的位置
         let str6 = 'i thining in javascript';
         var index=str6.indexOf('java');
         console.log('java出现在'+index);
         //最后出现in的位置
                  let str7 = 'hello@163.com';
                  var index=str7.lastIndexOf('in');
         console.log('in出现在'+index);
         //截取字符串163
         var subStr=str7.substring(str7.indexOf('@')+1,str7.indexOf('163'));
         console.log('截取结果是'+subStr);




         let str8= '           hello    js     ';
          let clearstr =str8.trimLeft();
         console.log(clearstr);
         clearstr =str8.trimRight();
         console.log(clearstr);
         str8=str8.trim();
         console.log(str8)

         let str9 = 'Hello javascript';
         //全小写
         str9 = str9.toLowerCase();
         console.log(str9);
         //全大写
        str9=str9.toUpperCase();
         console.log(str9);
        strs = str10.split('\.');
        for(var i=0;i<=str10.length;i++){
                console.log(strs[i]);
        }
         let str10 = '168.45.95.23';
         //拆分ip地址获得所有数字
         let str11 ='makamkam';
         //获得最后一个位置出现的字符
         str11 = str11.charAt(str11.length-1);
         console.log(str11);


    </script>

</body>
</html>